<html>
<head>
<link href="../../../Objects/sofa_white.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div id="contenu">
		
		<center><h3>Mesh Loading and Rendering 3 (3/7)</h3>
		  <br><br>
		  <img src="2_Visual.png" name="Visu_start" align="middle" width=300>
		</center>

		
		<br><div id="orangeText">Description</div>
		<p> Now we will go into more detail on how to use <strong>OglModel</strong>.</p>
        
		<div id="orangeText">Key points</div>
        
        <div id="tutorialAction"><p>Clear the scene graph.</p></div>
        
        <p>We will start by setting up a simple scene.</p>
        
        <div id="tutorialAction"><p>Add two <strong>GNodes</strong> to the <strong>root</strong> node. Name one "DragonVisu" and the other "TexturedSofaVisu".</p>
        <p>Add an <strong>OglModel</strong> to each of the two new nodes. Name them "dragon" and "sofa".</p>
        
        <p>Change the <strong>Path to the model</strong> in <strong>dragon</strong> to <strong>/Sofa/share/mesh/dragon.obj</strong> and the <strong>Path to the model</strong> in <strong>sofa</strong> to <strong>/Sofa/share/mesh/canapVM.obj</strong>.</p>
        
		<p>Run in SOFA</p></div>		
        
		<p>The model is now correctly loaded and rendered; but we want to customize it.</p>
		<p>Different kinds of parameters are offered through <b>OglModel</b> :</p>
        <p>
		<ul>
		<li>Transformation : <i>rotation</i>, <i>translation</i> and <i>scale</i>, each as a vector of 3 floats</li>
		<li>Materials : describes ambient, diffuse, specular, emissive and shininess components. 
		This is loaded either in a .MTL file attached to the OBJ; or as a string with the field <i>material</i>. You can also
		use the <i>color</i> field, which will fill the material fields accordingly.</li>
		<li>Texture : basic texture mapping with <i>texturename</i> field</li>
		</ul>
        </p>


        <div id="tutorialAction"><p>In the properties for <strong>dragon</strong>, change the <strong>Initial Translation of the object</strong> to (0 10 2), the <strong>Initial Rotation of the object</strong> to (90 0 0) and the <strong>Initial Scale of the object</strong> to (0.5 0.5 0.5).</p>

		<p>In the <strong>Property 2/3</strong> tab, change the <strong>Ambient</strong> property to (0 191 0 255) and the <strong>Diffuse</strong> property to (51 51 0 229). Check the <strong>Specular</strong> and the <strong>Shininess</strong> checkboxes. Set <strong>Specular</strong> to (204 204 204 255) and <strong>Shininess</strong> to 25.</p>
        
        <p>Run in SOFA.</p></div>
        
        <p>Now we have a green dragon lying on the sofa.</p>

		<div id="tutorialAction"><p>In the <strong>Property 2/3</strong> tab of the <strong>sofa</strong>, set the <strong>Name of the Texture</strong> to <strong>/Sofa/share/textures/snakeskin.png</strong> using the file browser.</p>
        
        <p>Run in SOFA.</p></div>
        
        <p>Now our sofa has been customized as well.</p>

        <br><center><h3><a href="3_Visual.scn">Next</a></center></h3>
	</div>
</body>
</html>
